// TargetPropertyPage.cpp : implementation file
//

#include "stdafx.h"
#include "configgui.h"
#include "..\resource\ConfigGUI\resrc1.h"
#include "TargetPropertyPage.h"
#include "TrainDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTargetPropertyPage property page

IMPLEMENT_DYNCREATE(CTargetPropertyPage, CPropertyPage)

CTargetPropertyPage::CTargetPropertyPage() : CPropertyPage(CTargetPropertyPage::IDD)
{
	//{{AFX_DATA_INIT(CTargetPropertyPage)
	m_nTargVel = 0;
	//}}AFX_DATA_INIT
}

CTargetPropertyPage::~CTargetPropertyPage()
{
}

void CTargetPropertyPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTargetPropertyPage)
	DDX_Text(pDX, IDE_TARGVEL, m_nTargVel);
	DDV_MinMaxUInt(pDX, m_nTargVel, 0, 100);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTargetPropertyPage, CPropertyPage)
	//{{AFX_MSG_MAP(CTargetPropertyPage)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTargetPropertyPage message handlers

BOOL CTargetPropertyPage::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
	// TODO: Add your specialized code here and/or call the base class
	switch (((LPNMHDR)lParam)->code) 
    {
    case PSN_SETACTIVE:
		break;
	case PSN_KILLACTIVE:
		return TRUE;
	}

	return CPropertyPage::OnNotify(wParam, lParam, pResult);
}

BOOL CTargetPropertyPage::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	switch (pMsg->message)
	{
	case WM_KEYDOWN:
		switch (pMsg->wParam)
		{
		case VK_ESCAPE:
			::SendMessage(GetPropSheet()->GetContainer()->GetSafeHwnd(),
							WM_KEYDOWN, pMsg->wParam, pMsg->lParam);
			return TRUE;
		default:
			::TranslateMessage(pMsg);
			break;
		}
	}

	return CPropertyPage::PreTranslateMessage(pMsg);
}

BOOL CTargetPropertyPage::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	WORD wNotifyCode = HIWORD(wParam);
	
	if (EN_CHANGE == wNotifyCode)
	{
		SetModified();
	}

	return CPropertyPage::OnCommand(wParam, lParam);
}
